// 路由信息配置文件

// 1.导入路由相关的方法和组件
import { createBrowserRouter,Navigate } from "react-router-dom";

import Home from "./../pages/home";
import About from "./../pages/about";
import Mine from "./../pages/mine";
import One from "../pages/one";
import Two from "./../pages/two"
import NotFound from "./../pages/404"

// 2.实例化路由配置对象
const router = createBrowserRouter([
  {
    path: "/", //路由
    element: <Navigate to="/home"></Navigate>,//路由重定向
  },
  {
    path: "/home", //路由
    title: "首页",
    element: <Home></Home>,
    children:[
        {
            path:"",
            title:"第一个二级路由",
            element:<Navigate to="one"></Navigate>
        },
        {
            path:"one",
            title:"第一个二级路由",
            element:<One></One>
        },
        {
            path:"two",
            title:"第二个二级路由",
            element:<Two></Two>
        },

    ]
  },
  {
    path: "/about/:id/:name/:age",
    title: "关于",
    element: <About></About>,
  },
  {
    path: "/mine",
    title: "我的",
    element: <Mine></Mine>,
  },
  {
    path: "*",
    element: <NotFound></NotFound>,
  },
]);

export default router;
